package pl.edu.pjwstk.kor.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import pl.edu.pjwstk.kor.sbql4j.dev.DevQuery;

@Controller
@RequestMapping("/dev")
public class DevController {
	private final DevQuery query;
	
	@Autowired 
	public DevController(DevQuery query) {
		this.query = query;
	}
	
	@RequestMapping("/main.html")
	public ModelAndView getMain() {
		return new ModelAndView("/dev/main")
			.addObject("customers", query.getAllCustomers())
			.addObject("services", query.getAllServices())
			.addObject("deals", query.getAllDeals())
			.addObject("employees", query.getAllEmployees());
	}
}
